﻿<!DOCTYPE html>
<html>
<head runat="server">
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Layout/MasterPage.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/Layout/cart.css")" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/jquery-1.5.1-vsdoc.js" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/js/jquery.1.6.3.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/js/h5f.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/js/functions.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/js/jquery.easing.1.3.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/js/jquery.lightbox_me.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/js/jquery.dropkick-1.0.0.js")" type="text/javascript" charset="utf-8"></script>
    <script src="@Url.Content("~/Scripts/js/slides.jquery.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/js/jquery.countdown.js")" type="text/javascript"></script>
    <script type="text/javascript">
        function load() {
            var text = '@HttpContext.Current.Session["user"]';
            $("#displaylogin").text(text);
            $("#login_link").hide();
            $("#loginsc").show();
        };
        function Add2Cart(idKM) {
            $.ajax({
                url: '@Url.Action("AddCartItem", "Home")',
                type: "POST",
                data: { maKM: idKM },
                success: function (data) {
                    if (data.rs == "success") {
                        $("#panel").html(data.partial.toString());
                        $("#panel").show('fast').delay(50).hide('fast');
                    }
                }
            });
        };

        function ClearCart() {
            $.ajax({
                url: '@Url.Action("ClearCart", "Home")',
                type: "POST",
                data: null,
                success: function (data) {
                    if (data.rs == "success") {
                        $("#panel").html(data.partial.toString());
                    }
                }
            });
        };

        function PayCart() {
            $.ajax({
                url: '@Url.Action("PayCart", "Home")',
                type: "POST",
                data: null,
                async: false,
                success: function (data) {
                    if (data.rs == "fail") {
                        alert("Bạn không có mặt hàng để thanh toán");
                    } else {
                        window.location.href = '@Url.Action("Payment", "Home")';
                    }
                }
            });
        };

        function UpdateCart() {
            $.ajax({
                url: '@Url.Action("getCart", "Home")',
                type: "POST",
                data: null,
                success: function (data) {
                    if (data.rs == "success") {
                        $("#panel").html(data.partial.toString());
                    }
                }
            });
        };

        function ViewOrders(id) {
            $.ajax({
                url: '@Url.Action("getDetail", "Home")',
                type: "POST",
                data: { order: id },
                async: false,
                success: function (data) {
                    if (data.rs == "success") {
                        $("#panelViewDetail").html(data.partial.toString());
                        $("#panelViewDetail").show('fast');
                    }
                }
            });
        };

        function CreateDealView() {
            $.ajax({
                url: '@Url.Action("getCreateView", "Home")',
                type: "POST",
                data: null,
                async: false,
                success: function (data) {
                    if (data.rs == "success") {
                        $("#panelViewDetail").html(data.partial.toString());
                        $("#panelViewDetail").show('fast');
                    } else {
                        alert(data.partial.toString());
                    }
                }
            });
        };

        function AddDeal() {
            $("#errorCreate").html("");
            $.ajax({
                url: '@Url.Action("AddDeals", "Home")',
                type: "POST",
                data: $("#CDForm").serialize(),
                success: function (data) {
                    var success = data.rs;                    
                    if (success == "success") {
                        $("#errorCreate").html("<span>Lưu thông tin thay đổi thành công!</span>");
                        $('#panelViewDetail').hide('fast');
                        window.location.href = '@Url.Action("DislayView", "UserInfo", new { name = "_ttdn" })';
                    } else {                        
                        $("#errorCreate").html("<span>" + data.detail + "</span>");
                    }
                }
            });
        };            
    </script>
    <script type="text/javascript">
        var sig;
        $(document).ready(function () {
            //Check logon        
            @{
                var logon = HttpContext.Current.Session["logon"] as string;
            };
            $('#cancellogin').click(function () {
                $('#pageContainer').trigger('close');
            });
            $('#selectCity').dropkick({
                change: function (value, label) {
                    if(value == 1)
                        window.location.href="/Home/Index?place=1";
                    else
                    {
                        var str = "Bạn đã chọn khu vực ";
                        str += label +". Khu vực này hiện chưa có deal.";
                        this.text = label;
                        alert(str);
                    }
                }
            });
            sig = '@logon';
            if (sig == "on" && sig)
                load();

            $('#login_link').click(function () {
                $('#pageContainer').lightbox_me();
            });
                                 
             $("#btnSend").click(
            function () {
            if(sig == "on" && sig)
            {
            var cm = $("#txtCommentDeal").val();
            var acc = '@HttpContext.Current.Session["user"]'      
            var sp =   window.document.URL.toString();
            sp = sp.substring(sp.lastIndexOf("/")+1,sp.length);
            $.ajax({
                url: '@Url.Action("SendComment", "Home")',
                type: "POST",
                data: { comment: cm, account: acc, maSP: sp},                
                success: function (data) {
                    if (data.result == "success")
                        alert("Send Successfully!");
                    else
                        alert(data.result);
                }
            });            
            } else alert("Please login!");      
            });
           
            $("#send").click(
            function () {
                $.ajax({
                    url: '@Url.Action("RegisterGetDeal", "Home")',
                    type: "POST",
                    data: {emailRegis : $("#txtEmail").val()},                    
                    success: function (data) {
                        if(data.result == "success")
                        alert("Successfully!");
                        else
                        alert(data.result);
                    }
                });
            });

            /*----------------------------------CART-----------------------------------*/            
              $("#cart_trigger").mouseenter(
            function () {                        
                $.ajax({
                    url: '@Url.Action("getCart", "Home")',
                    type: "POST",
                    data: null,
                    async: false,
                    success: function (data) {   
                        if(data.rs == "success")
                        {                 
                            $("#panel").html(data.partial.toString());
                            $("#panel").show();                                                          
                        }
                    }
                });                                  
            });
                        
            /*------hover cart show hide-- turn off to css inspect----*/
            $("#panel").mouseleave(function () {                
                $('#panel').toggle("fast");                   
            });

            $(".btmiddle").click(function () {
                if ($(".btmiddle").hasClass("bt")) {
                    $(".btmiddle").removeClass("bt");
                    $(".btmiddle").addClass("clicked");
                    $("#tooltipmenu").show();
                } else {
                    $(".btmiddle").removeClass("clicked");
                    $(".btmiddle").addClass("bt");
                    $("#tooltipmenu").hide();
                }
            });

            $('#logon').click(function () {
                $("#error").html("");
                var username = $('#login-username').val();
                var password = $('#login-password').val();
                var sign = $('#remember-me').val();
                var remem = true;
                if (sign == "off")
                    remem = false;
                var data = {
                    email: username,
                    pass: password,
                    remember: remem
                };
                $.ajax({
                    url: '@Url.Action("Logon", "Account")',
                    type: "POST",
                    data: data,
                    async:false,
                    success: function (result) {
                        var success = result.rs;
                        if (success == "success") {
                            $("#displaylogin").text(username);
                            $("#pageContainer").trigger('close');
                            $("#login_link").hide();
                            $("#loginsc").show();
                            sig = "on";
                        }
                        else {
                            $("#error").html("<span>" + result.detail + "</span>");
                        }
                    }
                });
            });

            $('#logout').click(function () {
                $.ajax({
                    url: '@Url.Action("Logoff", "Account")',
                    type: "GET",
                    data: null,
                    async: false                    
                    });
                    sig = "off";
                });

                $('#register').submit(function () {
                    $("#errorregister").html("");
                    var username = $("#email").val();
                    $.ajax({
                        url: '@Url.Action("Register", "Account")',
                        type: "POST",
                        data: $("#register").serialize(),
                        async: false,
                        success: function (result) {
                            var success = result.rs;
                            if (success == "success") {
                                $("#displaylogin").text(username);
                                $("#pageContainer").trigger('close');
                                $("#login_link").hide();
                                $("#loginsc").show();
                                sig = "on";
                            }
                            else {
                                $("#errorregister").html("<span>" + result.detail + "</span>");

                            }
                        }
                    });
                });

                /////////////////////END CART AND LOGIN REGISTER///////////////////////           
                ///////////////////////////////////////////////////////////////////////    

                $('.default').dropkick();
                $(window).scroll(function () {
                    if (sig == "on" && sig) {
                        if ($(this).scrollTop() > 550) {                                                             
                            $("#cart_trigger").show();                            
                        }
                        else {
                            $("#cart_trigger").hide();
                            $("#panel").hide();                            
                        }
                    }

                    if ($(this).scrollTop() != 0) {
                        $('#toTop').fadeIn();
                    } else {
                        $('#toTop').fadeOut();
                    }
                });

                $('#toTop').click(function () {
                    $('body,html').animate({ scrollTop: 0 }, 800);
                });
                $('#slides').slides({
                    preload: true,
                    preloadImage: 'img/loading.gif',
                    play: 5000,
                    pause: 2500,
                    hoverPause: true,
                    animationStart: function (current) {
                        $('.caption').animate({
                            bottom: -35
                        }, 100);
                        if (window.console && console.log) {
                            // example return of current slide number
                            console.log('animationStart on slide: ', current);
                        };
                    },
                    animationComplete: function (current) {
                        $('.caption').animate({
                            bottom: 0
                        }, 200);
                        if (window.console && console.log) {
                            // example return of current slide number
                            console.log('animationComplete on slide: ', current);
                        };
                    },
                    slidesLoaded: function () {
                        $('.caption').animate({
                            bottom: 0
                        }, 200);
                    }
                });
            });
    </script>
</head>
<body style="background: url(images/bgbody.png) #7DC35A repeat-x">
    <div id="panel" class="panel">
    </div>
    <div id="panelViewDetail" class="panel">
    </div>
    <div id="header">
        <!-- Header -->
        <div id="logo">
            <!-- Logo -->
            <a href="@Url.Action("Index", "Home")" style="display: block; text-indent: -9000px;">
                B4DealPlaza</a>
        </div>
        <div id="city">
            <!-- Select city-->
            <div align="left" style="line-height: normal">
                <span style="line-height: normal; text-align: left; color: #FFF; font-size: 14px"><strong>
                    CHỌN THÀNH PHỐ</strong></span>
            </div>
            <div style="margin-top: 10px">
                <select id="selectCity" name="country" class="default" tabindex="2">
                    <option value="1">Hồ Chí Minh</option>
                    <option value="2">Hà Nội</option>
                    <option value="3">Hải Phòng</option>
                    <option value="4">Cần Thơ</option>
                </select>
            </div>
        </div>
        <div style="float: right; height: 60px; margin-top: 20px; line-height: normal; margin-right: 3.5%">
            <div align="left">
                <span style="line-height: normal; text-align: left; color: #FFF; font-size: 14px"><strong>
                    NHẬN THÔNG TIN DEAL HẤP DẪN MỖI NGÀY</strong></span>
            </div>
            <div class="bg-email">
                <span class="bg-email"><span class="bg-email-inner">
                    <input id="txtEmail" type="text" placeholder="Nhập email của bạn" />
                </span><span class="btn-email-border"><span class="btn-email"><em id="send">Gửi</em>
                </span></span></span><span class="ico-email"></span>
            </div>
            <!-- input email -->
        </div>
    </div>
    <div id="login">
        <!-- Log in -->
        <a href="javascript:void()" class="poplogin" id="login_link" style="visibility: visible;">
            Đăng nhập | Đăng ký </a>
        <div id="loginsc" align="center">
            <a href="javascript:void()" class="bt btmiddle">
                <label id="displaylogin" style="font-size: 10px">
                </label>
                <span>&#9660;</span></a>
            <div id="tooltipmenu">
                <div id="triangle">
                </div>
                <div id="tooltip_menu" align="left">
                    <a href="@Url.Action("Index", "UserInfo")" class="menu_top">
                        <img alt="TTCN" src="@Url.Content("~/Content/Layout/Images/1.png")" />
                        Thông tin cá nhân </a><a href="javascript:void()" class="menu_top">
                            <img alt="deal" src="@Url.Content("~/Content/Layout/Images/2.png")" />
                            Thỏa thuận sử dụng </a><a href="@Url.Action(@ViewContext.RouteData.Values["action"].ToString())" id="logout" class="menu_bottom">
                                <img alt="exit" src="@Url.Content("~/Content/Layout/Images/3.png")" />
                                Thoát </a>
                </div>
            </div>
        </div>
    </div>
    <div id="menu">
        <!-- Menu -->
        <ul>
            <li class="blue" id="limenu">
                <p style="margin-top: 10px">
                    <a id="amenu" href="@Url.Content("~/Home/Index")"><strong style="font-size: 20px;
                        text-align: justify;">Giá tốt hôm nay</strong></a></p>
                <p class="subtext" style="font-size: 20px; padding-top: 30px !important">
                    Giá tốt trong ngày</p>
            </li>
            <li class="yellow" id="limenu">
                <p style="margin-top: 10px">
                    <a id="amenu" href="@Url.Content("~/Home/ListDeals")"><strong style="font-size: 20px;">
                        Giá tốt gần đây</strong></a></p>
                <p class="subtext" style="font-size: 20px; padding-top: 30px !important">
                    Giá tốt trong tuần</p>
            </li>
            <li class="red" id="limenu">
                <p style="margin-top: 10px">
                    <a id="amenu" href="@Url.Content("~/Home/About")"><strong style="font-size: 20px;">Giúp
                        đỡ</strong></a></p>
                <p class="subtext" style="font-size: 20px; padding-top: 30px !important">
                    Thông tin về B4Deal</p>
            </li>
        </ul>
        <div id="findbox">
            <!-- Find-->
            <fieldset style="padding-top: 8px; float: right; margin-right: 10px; z-index: 1;">
                <input type="submit" value="Submit" id="submitButton" />
                <input id="s" type="text" />
            </fieldset>
        </div>
    </div>
    <div id="pageContainer">
        <!-- Tabs -->
        <ul id="tabs" class="clearfix">
            <li class="activeTab" id="signInTab">
                <div class="signInTabContent">
                    <span>Bạn đã có tài khoản rồi?</span>
                    <h1>
                        Đăng nhập</h1>
                </div>
                <span class="activeTabArrow">
                    <!-- -->
                </span></li>
            <li class="inactiveTab" id="signUpTab">
                <div class="signUpTabContent">
                    <span>Bạn chưa có tài khoản?</span>
                    <h1>
                        Đăng ký ngay</h1>
                </div>
                <span class="activeTabArrow">
                    <!-- -->
                </span></li>
        </ul>
        <!-- Sign In Tab Content -->
        <div id="signIn" class="toggleTab">
            <form action="javascript:void()" class="cleanForm">
            <p id="error" class="validation-summary-errors" style="padding-left: 140px !important;">
            </p>
            <fieldset>
                <p style="padding: 0px; margin-bottom: 15px">
                    <label for="login-username">
                        Tài Khoản:</label>
                    <input type="text" id="login-username" name="login-username" value="" autofocus required />
                </p>
                <p style="padding: 0px; margin-bottom: 15px">
                    <label for="login-password">
                        Mật Khẩu:</label>
                    <input type="password" id="login-password" name="login-password" value="" required />
                </p>
                <div class="distanceLeft">
                    <input type="checkbox" id="remember-me" name="remember-me" value="off" onchange="if(this.checked) this.value = 'on';else this.value = 'off';" />
                    <label for="remember-me">
                        Nhớ tài khoản</label>
                </div>
                <div style="display: inline; margin-left: 125px">
                <input style="margin: 0" id="logon" type="submit" value="Đăng nhập" />
                <input style="margin-left: 10px" id="cancellogin" type="submit" value="Hủy bỏ" />
                </div>
            </fieldset>
            </form>
        </div>
        <!-- end signIn -->
        <!-- Sign Up Tab Content -->
        <div id="signUp" class="clearfix toggleTab">
            <form action="javascript:void()" class="cleanForm" id="register">
            <p id="errorregister" class="validation-summary-errors" style="padding-left: 150px !important;">
            </p>
            <fieldset>
                <p>
                    <label for="email">
                        Tài khoản: <span class="requiredField">*</span></label>
                    <input type="email" id="email" name="email" value="" required />
                    <label id="remind">
                        Ex: abc@gmail.com</label>
                </p>
                <p>
                    <label for="password">
                        Mật khẩu: <span class="requiredField">*</span></label>
                    <input type="password" id="password" name="password" value="" pattern="^[a-zA-Z0-9]{6,12}$"
                        required />
                    <label id="remind">
                        6 - 12 ký tự</label>
                </p>
                <p style="width: 800px; color: #808286">
                    <label for="username">
                        Họ tên: <span class="requiredField">*</span></label>
                    <input type="text" id="username" name="username" pattern="^\D{0,30}$" value="" required />
                    <label id="remind">
                        3 - 30 ký tự</label>
                </p>
                <p>
                    <label for="phone">
                        Điện thoại:</label>
                    <input type="tel" id="phone" name="phone" value="" pattern="^[0-9-]{10,}$" />
                    <label id="remind">
                        Ex: 01667319803</label>
                </p>
                <div class="distanceLeft">
                    <input type="checkbox" id="terms" name="terms" />
                    <label for="terms">
                        Tôi đã đọc và đồng ý <a href="javascript:void()">Điều khoản sử dụng</a>.</label>
                </div>
                <input style="margin-left: 350px;" type="submit" value="Đăng ký" id="okie" />
                <div class="formExtra">
                    <p>
                        <strong>Ghi chú: </strong>Các dòng <span class="requiredField">*</span>là bắt buộc.</p>
                </div>
            </fieldset>
            </form>
        </div>
        <!-- end signUp -->
    </div>
    <!-- end pageContainer -->
    <div style="margin-top: 50px" align="center">
        <div id="example">
            <img src="@Url.Content("~/Content/Layout/Images/new-ribbon.png")" width="112" height="112" alt="New Ribbon" id="ribbon"/>
            <div id="slides">
                <div class="slides_container">
                    <div class="slide">
                        <a href="" title="" target="_blank">
                            <img src="@Url.Content("~/Content/Layout/Images/slideshow/slide-1.jpg")" width="800" height="270" alt="Slide 1"/></a>
                        <div class="caption" style="bottom: 0" align="left">
                            <p>
                                Khách sạn Saphir Đà Lạt</p>
                        </div>
                    </div>
                    <div class="slide">
                        <a href="" title="" target="_blank">
                            <img src="@Url.Content("~/Content/Layout/Images/slideshow/slide-2.jpg")" width="800" height="270" alt="Slide 2"/></a>
                        <div class="caption" align="left">
                            <p>
                                Nhà hàng Oshiijaki</p>
                        </div>
                    </div>
                    <div class="slide">
                        <a href="" title="" target="_blank">
                            <img src="@Url.Content("~/Content/Layout/Images/slideshow/slide-3.jpg")" width="800" height="270" alt="Slide 3"/></a>
                        <div class="caption" align="left">
                            <p style="color: White !important">
                                Pricess spa</p>
                        </div>
                    </div>
                    <div class="slide">
                        <a href="" title="" target="_blank">
                            <img src="@Url.Content("~/Content/Layout/Images/slideshow/slide-4.jpg")" width="800" height="270" alt="Slide 4"/></a>
                        <div class="caption" align="left">
                            <p>
                                Ẩm thực Đông Hoa</p>
                        </div>
                    </div>
                    <div class="slide">
                        <a href="" title="&" target="_blank">
                            <img src="@Url.Content("~/Content/Layout/Images/slideshow/slide-5.jpg")" width="800" height="270" alt="Slide 5"/></a>
                        <div class="caption" align="left">
                            <p>
                                Sealion beach resort</p>
                        </div>
                    </div>
                </div>
                <a href="javascript:void()" class="prev">
                    <img src="@Url.Content("~/Content/Layout/Images/arrow-prev.png")" width="24" height="43" alt="Arrow Prev" /></a>
                <a href="javascript:void()" class="next">
                    <img src="@Url.Content("~/Content/Layout/Images/arrow-next.png")" width="24" height="43" alt="Arrow Next"/></a>
            </div>
            <img src="@Url.Content("~/Content/Layout/Images/example-frame.png")" width="969" height="341" alt="Example Frame" id="frame"/>
        </div>
    </div>
    <div id="content" class="wrapper" align="center">
        @RenderBody()
    </div>
    <div id="toTop">
    </div>
    <!-- Back to top -->
    <div id="mainfooter" align="center">
        <div id="footercontent">
            <span>Liên hệ:&nbsp<a href="mailto:trongnghia09ctt2@gmail.com" style="color: Blue">trongnghia09ctt2@gmail.com</a>
                </br> Bản quyền 2011 - 2012 B4 TH2009/03 </span><b><a href="@Url.Content("~/Home/Index")" style="color: Blue">
                    Trang chủ</a> &nbsp&nbsp <a href="@Url.Content("~/Home/ListDeals")" style="color: Blue">
                        Giá tốt gần đây</a> </b>
        </div>
    </div>
    <a id="cart_trigger" class="triger" href="javascript:void()"></a>
    <script type="text/javascript">
        $("#cart_trigger").hide();</script>
</body>
</html>
